<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function Person(name,age,gender){
            this.name=name
            this.age=age
            this.gender=gender
            this.sayHi=function(){
                console.log(name); //xiaoming
                console.log(this.name); //xiaoming
                
                console.log('我叫'+name+'我今年'+age+'岁');

                console.log('我叫'+this.name+'我今年'+this.age+'岁');
            }
        }
        var xiaoming=new Person('xiaoming',10,'male')
        xiaoming.sayHi()

        var xiaohong=new Person('xiaohong',12,"female")
        console.log(xiaohong);
        xiaohong.sayHi()
    </script>
</body>
</html>